
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 09/19/2014 23:49:04
-- Generated from EDMX file: D:\Users\Ming\Documents\Visual Studio 2012\Projects\Expressing Label\Expressing Label\BNUFACE.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [db_FACE];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[tb_ExpressingInfo]', 'U') IS NOT NULL
    DROP TABLE [dbo].[tb_ExpressingInfo];
GO
IF OBJECT_ID(N'[dbo].[tb_UserInfo]', 'U') IS NOT NULL
    DROP TABLE [dbo].[tb_UserInfo];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'tb_ExpressingInfo'
CREATE TABLE [dbo].[tb_ExpressingInfo] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [UserID] int  NOT NULL,
    [ImageLocation] nvarchar(50)  NOT NULL,
    [Expressing_Self] nvarchar(10)  NOT NULL,
    [Expressing_Oth] nvarchar(10)  NULL,
    [CurrentVideoTime] nvarchar(20)  NOT NULL,
    [CurrentVideoContent] nvarchar(100)  NULL,
    [ExperimentStartTime] datetime  NOT NULL,
    [ExperimentDuration] int  NOT NULL,
    [Location] nvarchar(50)  NULL,
    [Weather] nvarchar(10)  NULL,
    [VideoSubject] nvarchar(10)  NULL,
    [OriginVideo] nvarchar(20)  NULL,
    [Expressing_OtherDetail] nvarchar(50)  NOT NULL,
    [OtherTimes] int  NOT NULL,
    [MaxEpressing] nvarchar(10)  NULL,
    [MaxTimes] int  NOT NULL
);
GO

-- Creating table 'tb_UserInfo'
CREATE TABLE [dbo].[tb_UserInfo] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [UserID] int  NOT NULL,
    [PHysicalCondition] nvarchar(50)  NULL,
    [SelfDiscribing] nvarchar(100)  NULL,
    [Character] nvarchar(10)  NOT NULL,
    [Gender] bit  NOT NULL,
    [Department] nvarchar(20)  NOT NULL,
    [SumOfExpressing] int  NULL,
    [SumOfDetail] nvarchar(max)  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [ID] in table 'tb_ExpressingInfo'
ALTER TABLE [dbo].[tb_ExpressingInfo]
ADD CONSTRAINT [PK_tb_ExpressingInfo]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'tb_UserInfo'
ALTER TABLE [dbo].[tb_UserInfo]
ADD CONSTRAINT [PK_tb_UserInfo]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------